#include "sea_config.h"
#include "sea_defines.h"

#include "test_object.h"
#include "test_words.h"
#include "test_meta_system.h"
#include "test_parser.h"
#include "test_sm.h"
#include "test_performance.h"
#include "test_notifier.h"
#include "test_dispatcher.h"
#include "test_timer.h"
#if defined( SEA_OS_QT ) || defined( SEA_OS_WIN32 )
#include "test_os_win.h"
#endif

// -------------------------------------------------------------------------------------------------

#define USE_TEST_OBJECT
#define USE_TEST_ASSOCIATIONS
#define USE_TEST_STATE_MACHINE
#define USE_TEST_SERVER
// #define USE_TEST_WORDS
#define USE_TEST_SIGNALING_OBJECTS
#define USE_TEST_PERFORMANCE
#define USE_TEST_TIMER
#define USE_TEST_META_SYSTEM
#define USE_TEST_STATE_MACHINE_DISPATCHER
#define USE_TEST_STATE_MACHINE_PARSER
#define USE_TEST_NOTIFIER

// -------------------------------------------------------------------------------------------------

typedef void ( *SeaTest )( );

void test_server( );
void test_associations( );

// -------------------------------------------------------------------------------------------------

using namespace sea;

SeaTest all_of_them[ ] = 
{
#if defined( USE_TEST_OBJECT )
    test_object,                    ///< Objects test
#endif
#if defined( USE_TEST_ASSOCIATIONS )
    test_associations,              ///< Test associations
#endif
#if defined( USE_TEST_STATE_MACHINE )
    test_state_machine,             ///< State machine test
#endif
#if defined( USE_TEST_SERVER )
    test_server,                    ///< Simple event handler( server )
#endif
#if defined( USE_TEST_WORDS )
    test_words,                     ///< Vocabulary
#endif
#if defined( USE_TEST_SIGNALING_OBJECTS ) && ( defined( SEA_OS_QT ) || defined( SEA_OS_WIN32 ) )
    test_signaling_objects,         ///< Test signaling object performance
#endif
#if defined( USE_TEST_PERFORMANCE )
    test_performance,               ///< Test performance
#endif
#if defined( USE_TEST_TIMER )
    test_timer,                     ///< User side timer test in the state machine
#endif
#if defined( USE_TEST_META_SYSTEM )
    test_meta_system,               ///< Meta system for non-Qt platforms
#endif
#if defined( USE_TEST_STATE_MACHINE_DISPATCHER )
    test_state_machine_dispatcher,  ///< User dispatched state machines
#endif
#if defined( USE_TEST_STATE_MACHINE_PARSER )
    test_state_machine_parser,      ///< State machine parser
#endif
#if defined( USE_TEST_NOTIFIER )
    test_notifier,                  ///< State machine parser
#endif
};

// -------------------------------------------------------------------------------------------------


int main( int argc, char* argv[ ] )
{
#if defined( SEA_OS_QT )
    QApplication app( argc,argv );
#else
    SEA_UNUSED( argc );
    SEA_UNUSED( argv );
#endif

    int r = 1;

    // Run tests
    int n = sizeof( all_of_them ) / sizeof( SeaTest );
    
    for( int i = 0; i < r; i++ )
    {
        for( int j = 0; j < n; j++ )
        {
            all_of_them[ j ]( );
        }
    }

    return 0;
}

// -------------------------------------------------------------------------------------------------

